package com.youku
{
   public class P2PConfig extends Object
   {
      
      public function P2PConfig() {
         super();
      }
      
      public static const LOAD_FAIL_ERROR:String = "p2p_load_swffail";
      
      public static const SOCKET_FAIL_ERROR:String = "p2p_socket_fail";
      
      public static const DONT_LOAD_ERROR:String = "p2p_dont_load";
      
      public static const LOAD_LIB_SUCCESS:String = "p2p_load_lib_success";
      
      public static var InitP2PType:String = "";
      
      public static var P2PStatus:String = "";
      
      public static var NSBufferEmptyDiff:Number = 1;
      
      public static var NSBufferFullDiff:Number = 5;
      
      public static var isYKUseP2P:Boolean = false;
      
      public static function reset() : void {
         P2PStatus = "";
      }
      
      public static function get isXNetPlayer() : Boolean {
         return InitP2PType == "ppweb";
      }
      
      public static function get isSSPlayer() : Boolean {
         return InitP2PType == "ss";
      }
      
      public static function get isYoukuP2PPlayer() : Boolean {
         return InitP2PType == "youku-p2p";
      }
      
      public static function get isP2PPlayer() : Boolean {
         return !(InitP2PType == "");
      }
      
      public static function get isLoadFail() : Boolean {
         if(P2PStatus == LOAD_FAIL_ERROR || P2PStatus == DONT_LOAD_ERROR)
         {
            return true;
         }
         return false;
      }
      
      public static function get isSocketFail() : Boolean {
         return P2PStatus == SOCKET_FAIL_ERROR;
      }
      
      public static function get isP2PRunning() : Boolean {
         return !(InitP2PType == "" || (isSocketFail) || (isLoadFail));
      }
      
      public static function get p2pFlag() : String {
         if(isXNetPlayer)
         {
            return "w";
         }
         if(isSSPlayer)
         {
            return "p";
         }
         if(isYoukuP2PPlayer)
         {
            return "u";
         }
         return "";
      }
      
      public static function get ypp() : String {
         var _loc1_:* = "0";
         if(isSSPlayer)
         {
            _loc1_ = "4";
            if(!isP2PRunning)
            {
               _loc1_ = _loc1_ + "0";
            }
         }
         if(isXNetPlayer)
         {
            _loc1_ = "3";
            if(!isP2PRunning)
            {
               _loc1_ = _loc1_ + "0";
            }
         }
         if(isYoukuP2PPlayer)
         {
            _loc1_ = "2";
            if(!isP2PRunning)
            {
               _loc1_ = _loc1_ + "0";
            }
         }
         return _loc1_;
      }
   }
}
